package com.fresh.auth.controller;

import com.fresh.auth.Service.MenuService;
import com.fresh.common.ResponseResult;
import com.fresh.entity.Menu;
import com.fresh.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/menu")
public class MenuController {

    @Autowired
    MenuService menuService;

    @PostMapping("/menu")
    public ResponseResult menu(@RequestBody User user){
        List<Menu> menus = menuService.getMenu(user.getUserId());
        return new ResponseResult<>(200,"success",menus);
    }

}
